import LangView from "./LangView";
import ResItem from "../res/ResItem";

const { ccclass, property } = cc._decorator;

@ccclass
export  class LangSprite extends LangView{
    updateValue(){
        if(!this.manager){
            cc.warn(" this.manager  is null ");
            return;
        }
        let sprite = this.node.getComponent(cc.Sprite);
        let spriteName = this.manager.getValue(this.langID);
        if(sprite && spriteName){
            this.getLoader().loadRes(spriteName,cc.SpriteFrame,(err,item:ResItem)=>{
                if(err || !this.node){
                    return;
                }
                sprite.spriteFrame = item.getRes();

            });
        }
    }
}
